from os import listdir
import hhparser

def translatefiles(dir_path):    
    hands = []
    for file_name in listdir(dir_path):
        hands += (translatefile(dir_path, file_name))
    return hands

def translatefile(dir_path, file_name):
    hands = []
    hh_lines = ''
    file = open(dir_path + '\\' + file_name)
    for line in file:
        if line != '\n':
            hh_lines += line
        else:                    
            if hh_lines != '':
                hands.append(hhparser.pokerstars(hh_lines))
                hh_lines = ''
    return hands